/*
 * @lc app=leetcode id=123 lang=cpp
 *
 * [123] Best Time to Buy and Sell Stock III
 */
class Solution {
public:
    int maxProfit(vector<int>& prices) {
        int maxPro = 0;
        int len = prices.size();
        if (len < 2) {
            return maxPro;
        }

        int b1 = prices[0];
        int s1 = prices[0];
        int b2 = prices[0];
        int s2 = prices[0];

        for (int i=1; i<len; i++) {
            s2 = std::max(s2, prices[i]);
            b2 = std::max(s1, prices[i]);
            s1 = std::max(s1, prices[i]);
            b1 = std::min(b1, prices[i]);
        }
        
    }
};

